package com.gouwudai.gobbs.service.impl;

import java.util.List;

import org.extremecomponents.table.limit.Limit;

import com.gouwudai.gobbs.common.Constants;
import com.gouwudai.gobbs.common.IPageList;
import com.gouwudai.gobbs.dao.IMasterGradeDAO;
import com.gouwudai.gobbs.pojo.TbbsMasterGrade;
import com.gouwudai.gobbs.service.IMasterGradeService;
import com.litt.core.exception.BusiException;
import com.litt.core.util.ExtremeTableUtil;

public class MasterGradeServiceImpl implements IMasterGradeService
{
	IMasterGradeDAO masterGradeDAO;
	
	public void save(TbbsMasterGrade tbbsMasterGrade) throws BusiException
	{	
			masterGradeDAO.save(tbbsMasterGrade);
	}

	public TbbsMasterGrade load(Integer id)
	{
		return (TbbsMasterGrade)masterGradeDAO.load(id);
	}

	public void update(TbbsMasterGrade tbbsMasterGrade) throws BusiException
	{
			masterGradeDAO.update(tbbsMasterGrade);
	}

	public void delete(Integer Id) throws BusiException
	{
			masterGradeDAO.delete(Id);
	}
	
    public List listAll()
    {
    	return masterGradeDAO.listAll();
    }

	
	public IPageList listPage(int pageIndex,int pageSize,String sort)
	{
		return masterGradeDAO.listPage(pageIndex, pageSize,sort);
	}
	
	public void AutoBindingTable(javax.servlet.http.HttpServletRequest request)
	{
		Limit limit = ExtremeTableUtil.getLimit(request, Constants.DEFAULT_PAGE_SIZE);
        IPageList page = this.listPage(limit.getPage(), limit.getCurrentRowsDisplayed(),ExtremeTableUtil.getSort(limit));
		request.setAttribute("resultList",page.getRsList());
		request.setAttribute("totalRows",page.getTotalSize());
	}


	public void setMasterGradeDAO(IMasterGradeDAO masterGradeDAO) {
		this.masterGradeDAO = masterGradeDAO;
	}
	
}